/**
 * Copyright (C) 2017-2018 pinganfang, Inc. All Rights Reserved.
 */
package com.pingan.haofang.searchcloud.api.matedata;

import java.util.ServiceLoader;

/**
 * @author huhailiang937
 * @date 2017年7月5日下午5:52:44
 * @since 1.0.0
 */
public class IndexMetadataHolderFactory {

    
    private static IndexMetadataHolder metadataHolder;

    public static IndexMetadataHolder get() {
        if (null != metadataHolder) {
            return metadataHolder;
        }
        ServiceLoader<IndexMetadataHolder> metadataHolders = ServiceLoader.load(IndexMetadataHolder.class);
        for (IndexMetadataHolder holder : metadataHolders) {
            metadataHolder = holder;
        }
        return metadataHolder;
    }
}
